package com.ftg.learn.service;

import com.ftg.learn.mapper.CarMapper;
import com.ftg.learn.pojo.Car;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarService {
    @Autowired
    CarMapper carMapper;

    //查询方法showall
    public List<Car>showall(int page, int limit){
        int begin = (page - 1)*limit;
        return carMapper.showall(begin,limit);
    }
    //共多少条信息方法getcount
    public int getcount(){
        return carMapper.getcount();
    }
    //查一方法findone
    public List<Car> findone(String car_id, String car_name){
        return carMapper.findone(car_id,car_name);
    }
    //添加方法add
    public List<Car> add(Car car) {
        return carMapper.add(car);
    }
    //删除方法delete
    public int delete(String car_id){
        return carMapper.delete(car_id);
    }
    //修改方法updat
    public int update(Car car){
        return carMapper.update(car);
    }
}

